package com.stxx.stiot2.service;


import com.stxx.framwork.constants.FluxDataType;
import com.stxx.framwork.domain.model.PageQuery;
import com.stxx.framwork.domain.model.PageResult;
import com.stxx.framwork.support.OptionsService;
import com.stxx.stiot2.domain.Signal;
import com.stxx.stiot2.domain.Terminal;
import com.stxx.framwork.support.BaseService;
import com.stxx.stiot2.domain.cache.TerminalCache;

import java.sql.SQLException;
import java.util.Collection;
import java.util.List;
import java.util.Map;

/**
 * @author Fuzhenlei
 * @date 2025/01/15 16:40
 */
public interface TerminalService extends BaseService<Terminal,String> , OptionsService {

    TerminalCache getCache(String id);

    List<Terminal> queryByIds(Collection<String> ids);

    List<TerminalCache> queryGwAndCodeByProfile(String profileCode);

    String getProfile(String code);

    FluxDataType getFieldType(String terminalCode, String signalCode);

    Object getLastValue(String terminalCode, String signalCode);

    void setLastValue(String terminalCode, String signalCode, Object value);

    void setLastValues(String terminalCode, Map<String, Object> data);

    Map<String,Object> getLastValues(String terminalCode);

    int updateLastReportTime(TerminalCache terminalCache) throws SQLException;

    PageResult<Terminal> listBySw(String sw, PageQuery pageQuery) throws SQLException;


    void association(Long deviceId,Collection<String> terminals) throws SQLException;
    List<Terminal> queryByDeviceId(Long deviceId) throws SQLException;

    void createDevice(Terminal terminal)  throws SQLException;
}
